package com.cybertooth.dbconvenience.query.conditions;

import com.cybertooth.dbconvenience.query.columns.Column;
import com.cybertooth.dbconvenience.query.enums.ComparisonOperator;

/**
 * <p></p>
 *
 * @author dnelson
 */
public class BoundColumnCondition implements ColumnCondition {

	// -----------------------------------------------------------------------Fields

	protected Column column;
	protected ComparisonOperator comparisonOperator;

	// -----------------------------------------------------------------Constructors

	public BoundColumnCondition(Column column, ComparisonOperator comparisonOperator) {
		this.column = column;
		this.comparisonOperator = comparisonOperator;
	}

	// ---------------------------------------------------------------Public Methods

	/**
	 * {@inheritDoc}
	 */
	@Override
	public String toSql() {
		return new StringBuilder()
				.append(" ")
				.append(column.toSql()).append(this.comparisonOperator.toSql()).append("?")
				.append(" ")
				.toString();
	}
}
